Fix UID mapping: use keep-id:uid=1000,gid=1000 #61
Merged
yarikoptic merged 1 commit intocon:mainfrom Apr 1, 2026
Merged
Conversation
…-user Maps host user to container UID 1000 (node) regardless of host UID, giving a proper /etc/passwd entry and correct HOME=/home/node. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Member
|
Coolio - I will give it a shot later today! Did you use it for some resumed yolo session? I just want to make sure that no side effects and still be able to resume etc FWIW for such cases I also keep some yoh-test user on the system to test under |
Member
Author
|
Yep --resume works on my hacky node=1001 container at least. |
Contributor
|
nice! sounds like a clean solution to me :) now everyone is officially node inside the container. welcome to the club! |
yarikoptic
approved these changes
Apr 1, 2026
Member
yarikoptic
left a comment
There was a problem hiding this comment.
yes, also seems to work nice for me! great, thanks @asmacdo !
asmacdo
added a commit
that referenced
this pull request
Apr 4, 2026
- SELinux labels: :Z → :z (shared) for all default mounts (issue #51) - UID mapping: remove --user, update --userns to keep-id:uid=1000,gid=1000 (PR #61) - Add deno extra to build args, extras table, setup flags, PATH (PR #56) - Document container name reuse as claude --name session name - CI triggers: include enhs branch Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Change
--userns=keep-idto--userns=keep-id:uid=1000,gid=1000and drop the--user="$(id -u):$(id -g)"line.This is a two-line fix that I believe will resolve the root cause behind a handful of issues.
With
keep-id:uid=1000,gid=1000:nodepasswd entry/etc/passwd(no-e HOME=hack needed)/home/nodeis writable (you own it as UID 1000 inside)--useris no longer needed since the namespace mapping already sets the process UIDRequires podman >= 4.3 (October 2022).
Fixes / relates
Testing
@yarikoptic, since I'm 1000 to verify
keep-id:uid=works when host UID != container UID, I temporarilychanged the container's
nodeuser to UID 1001 and usedkeep-id:uid=1001,gid=1001.Could you give this a try (as is, you shouldnt need below hack) to be sure it will work for you?
Ugly hack to test in my env (not committed): change node UID to 1001 to exercise the mapping
Dockerfile change
Test output (host UID 1000, container node UID 1001)
Host UID 1000 was successfully mapped to container UID 1001 (
node).whoamiresolves, HOME is correct, and workspace files appear owned by thecontainer's
nodeuser (1001) which maps back to host UID 1000.@just-meng since you just took a dive into this stuff, also curious to hear your thoughts.